<?php
require_once 'dbconnect.php';
$sql = mysql_query("SELECT users.username, users.avatar, posts.content, posts.when
                    FROM posts
                    INNER JOIN users
                    ON posts.who=users.username
                    INNER JOIN movies
                    ON posts.what=movies.id WHERE movies.id=" . $_GET['id'] . "");
if (mysql_num_rows($sql) == 0) {
    echo '<p>Még senki nem szólt hozzá, legyen az első aki megteszi!</p>';
} else {
    while ($rekord = mysql_fetch_array($sql)) {
        ?>
        <div class="comment_window">
            <div class="user_pic">
                <img src="avatars/<?php echo $rekord['avatar']; ?>"/>
            </div>
            <div class="user_data">
                <div class="user_name">
                    <?php
                    echo $rekord['username'];
                    echo $rekord['when'];
                    ?>
                </div>
                <div class="user_comment">
                    <?php
                    echo $rekord['content'];
                    ?>
                </div>
            </div>
        </div>
        <?php
    }
}
?>